  <tr class="main_operation" valign="top">
    <td><%= operation.accounts.name %></td>
    <td><%= operation.timestamp.strftime("%d.%m.%Y %I:%M") %></td>
    <td><%= operation.shares.name %></td>
    <td><%= operation.quantity %></td>
    <td><%= sprintf("%0.2f", operation.price) %></td>
    <td><%= sprintf("%0.2f", operation.net_amount) %></td>
    <td><%= sprintf("%0.2f", operation.brokerage) %></td>
    <td><%= sprintf("%0.2f", operation.gross_amount) %></td>
    <td>
    <% if not operation.sold %>
      <%= link_to 'Sell', :action => 'sell', :id => operation %> &nbsp;
      <%= link_to 'Edit', :action => 'edit', :id => operation %> &nbsp;
      <%= link_to 'Delete', {:action => 'delete', :id => operation}, :confirm => "Are you sure want to delete? Think two times before clicking OK." %>
      <br/>
      <%= link_to_remote(
      "Min price: " + sprintf("%0.2f", operation.zeroPrice) + " (% " + sprintf("%0.2f", operation.zeroPercentage) + ")",
      :complete => "Element.toggle('mytr#{operation.id}')",
      :update => 'mydiv' + operation.id.to_s,
      :url => { :action => :calc, :id => operation.id }) %>
      <% else %>&nbsp;<% end %>
    </td>
  </tr>

  <% if operation.sell != nil %>
    <% for sell in operation.sell %>
    <tr>
      <td colspan="3" align="right">Sold on <%= sell.timestamp.strftime("%d.%m.%Y %I:%M") %></td>
      <td><%= sell.quantity %></td>
      <td><%= sprintf("%0.2f", sell.price) %></td>
      <td><%= sprintf("%0.2f", sell.net_amount) %></td>
      <td><%= sprintf("%0.2f", sell.brokerage) %></td>
      <td><%= sprintf("%0.2f", sell.gross_amount) %></td>
      <td>&nbsp;</td>
    </tr>
    <% end %>
  <% end %>


  <% if not operation.sold %>

  <script lang="JavaScript">
  <!--
  <%= remote_function(
  :update   => "simulateSelling_#{operation.id}",
  :url      => {:action => :simulateSelling, :params => {:id => operation.id}}) %>
  //-->
  </script>
  <tr id="simulateSelling_<%= operation.id %>">
      <%= render "index/simulateSelling" %>
  </tr>


  <script lang="JavaScript">
  <!--
  <%= remote_function(
  :update   => "potentialInOut_#{operation.id}",
  :url      => {:action => :potentialInOut, :params => {:id => operation.id}}) %>
  //-->
  </script>
  <tr id="potentialInOut_<%= operation.id %>" >
      <%= render "index/potentialInOut" %>
  </tr>


  <script lang="JavaScript">
  <!--
  <%= remote_function(
  :update   => "simulateTotal_#{operation.id}",
  :url      => {:action => :simulateTotal, :params => {:id => operation.id}}) %>
  //-->
  </script>
  <tr id="simulateTotal_<%= operation.id %>">
      <%= render "index/simulateTotal" %>
  </tr>


  <% end %>

  <tr id="mytr<%= operation.id %>" style="display:none;">
    <td colspan="9" align="right">
      <% if not operation.sold %>
      <%= form_remote_tag(:update => 'mydiv' + operation.id.to_s,
      :url => { :action => :calc, :id => operation.id} ) %>
      <div id="mydiv<%= operation.id %>" style="width: 50%; align: right;">
      </div>
      <%= end_form_tag %>
      <% end %>
    </td>
  </tr>
